<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no,viewport-fit=cover">
  <script src="https://jsmpeg.com/jsmpeg.min.js" charset="utf-8"></script>
  <title>播放rtsp</title>
  <style type="text/css">
    canvas,img {
      position: absolute;
      width: 100%;
      height: 100%;
      top: 0;
      left: 0;
    }
  </style>
</head>
<body>
<canvas id="canvas"></canvas>
</body>
<script>
  var urlParams = new URLSearchParams(window.location.search);
  var rtsp = decodeURIComponent(urlParams.get('rtspUrl'));

  window.onload = () => {
    new JSMpeg.Player("ws://192.168.20.149:10012/rtsp?url="+btoa(rtsp)+"&-s=1920x1080&scale=-1:-1", {
       canvas: document.getElementById("canvas"),
       poster:"http://192.168.20.149:16666/error.jpg",
       loop:true,
      autoplay:true,
      audio:false,
      video:true,
      //  disable WebGL and always use the Canvas2D renderer
      disableGl:false,
      disableWebAssembly:false,
      pauseWhenHidden:true,
      // 捕获截图或生成缩略图
      preserveDrawingBuffer:false,
      // playback can begin before 
      progressive:true,
      videoBufferSize:8192*1024,
      audioBufferSize:128*1024,
    })
  }
</script>
</html>
